package com.webside.wap.index.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.webside.base.baseservice.impl.AbstractService;
import com.webside.wap.common.mapper.BSeriesMapper;
import com.webside.wap.common.mapper.PBannerMapper;
import com.webside.loginfo.model.LogInfoEntity;
import com.webside.util.PageUtil;
import com.webside.wap.common.model.BSeries;
import com.webside.wap.common.model.PBanner;
import com.webside.wap.index.service.IndexService;
@Service("indexService")
public class IndexServiceImpl extends AbstractService<LogInfoEntity, Long> implements IndexService {
	@Autowired
	private PBannerMapper pBannerDao;
	@Autowired
	private BSeriesMapper bSerierDao;
	
	/*
	 * 获取搜索集合
	 */
	public List<BSeries> SearchSeriesByPageVo(BSeries bSeries, PageUtil pageUtil, String sort) {
		if (pageUtil!=null) {
			pageUtil.setPageSize(8);
			pageUtil.setPageNum((pageUtil.getPageNum()-1)*pageUtil.getPageSize());
		}else {
			pageUtil=new PageUtil();
			pageUtil.setPageNum(1);
			pageUtil.setPageSize(8);
		}
		int beginSize = pageUtil.getPageNum()*pageUtil.getPageSize()+1;
		return bSerierDao.searchSeriesByPageVo(bSeries, pageUtil,beginSize, sort);
	}
	

	/*
	 * 获取轮播图集合
	 */
	public List<PBanner> getAllByTarget(String target) {
		return pBannerDao.getAllByTarget(target);
	}
	
	/*
	 * 获取首页各分类集合
	 */
	public List<BSeries> selectIndexMovieByKind(BSeries bSeries) {
		return bSerierDao.selectIndexMovieByKind(bSeries);
	}
	
	

}
